//
//  DHRadioListTableViewCell.m
//  Moment
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 片刻. All rights reserved.
//

#import "DHRadioListTableViewCell.h"

@implementation DHRadioListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}
-(void)createView{
    _titleLabel = [UILabel new];
    [self.contentView addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(50 * HEIGHT * 0.2));
        make.left.equalTo(@(50 * HEIGHT * 0.2));
        make.height.equalTo(@(50 * HEIGHT * 0.3));
        make.width.equalTo(@(self.contentView.frame.size.width * 0.7));
    }];

    _nameLabel = [UILabel new];
    [self.contentView addSubview:_nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_titleLabel.mas_left);
        make.top.equalTo(_titleLabel.mas_bottom).offset(2);
        make.bottom.equalTo(@(- 50 * HEIGHT * 0.2));
        make.width.equalTo(_titleLabel.mas_width);
    }];

    
    _downloadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:_downloadBtn];
    [_downloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(- 50 * WIDTH * 0.2));
        make.top.equalTo(@(50 * WIDTH * 0.3));
        make.bottom.equalTo(@(- 50 * WIDTH * 0.3));
        make.width.equalTo(_downloadBtn.mas_height);
    }];
    [_downloadBtn setImage:[UIImage imageNamed:@"iconfont-xiazai"] forState:UIControlStateNormal];
}
-(void)setRadio:(DHSubRadio *)radio{
    if (_radio != radio) {
        _radio = radio;
    }
    _titleLabel.text = _radio.playinfo.title;
    _titleLabel.font = [UIFont systemFontOfSize:13];
    NSLog(@"_radio.title=%@",_radio.title);
    _nameLabel.text = [NSString stringWithFormat:@"by:%@",_radio.playinfo.userInfo.uname];
    _nameLabel.font = [UIFont systemFontOfSize:8];
    _nameLabel.textColor = [UIColor grayColor];
    
}
-(void)setMoreting:(Moreting *)moreting{
    if (_moreting != moreting) {
        _moreting = moreting;
    }
    _titleLabel.text = _moreting.playinfo.title;
    _titleLabel.font = [UIFont systemFontOfSize:13];
    NSLog(@"_radio.title=%@",_moreting.playinfo.title);
    _nameLabel.text = [NSString stringWithFormat:@"by:%@",_moreting.playinfo.userInfo.uname];
    _nameLabel.font = [UIFont systemFontOfSize:8];
    _nameLabel.textColor = [UIColor grayColor];
    

}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
